Database servers manage data for database clients. In a typical database system, database clients issue database commands to the database servers to cause the database server to create logical storage structures, such as tables, and to insert, update, read and delete items within those logical storage structures. The items that are managed by the database servers, as well as the logical structures used to contain the items, are typically stored on non-volatile memory, such as magnetic disks, provided by a storage system.
Before a database server can read or update data, the database server must retrieve the data from the storage system into volatile memory that is local to the database server. To prevent the same item from having to be retrieved every time it is needed, the database server typically stores the retrieved items in a buffer cache within the volatile memory that is local to the database server. Typically, the volatile memory used by the buffer cache is significantly faster, more expensive, and smaller than the non-volatile memory used by the storage system to persistently store the items. Consequently, even when the buffer cache is completely full, the buffer cache still only holds a fraction of the total data managed by the database server.
Because the buffer cache holds only a fraction of the total data managed by a database server, there is frequently a need to replace items in the buffer cache with newly requested items. Typically, the database server selects which items to replace based on how recently the items have been used, where least recently used items are replaced before more recently used items.
FIG. 1 is a block diagram illustrating a typical database system in which multiple clients (DB client A, DB client B and DB client C) issue commands to a database server 102. Database server 102 resides in the volatile memory 106 of a computing device. That same volatile memory is typically used for both the buffer cache (shown as shared cache 108), and for private memory 110A-110C. Private memory 110A-110C differs from shared cache 108 in that all DB clients A-C are allowed read items that reside in shared cache 108, but only the DB client A-C that corresponds to a particular private memory 110A-C is allowed to see items that reside in that private memory 110A-C. In the illustrated example, private memory 110A is used for operations requested by DB client A, private memory 110B is used for operations requested by DB client B, and private memory 110C is used for operations requested by DB client C.
Typically, when a database client requests to read an item that does not currently reside in volatile memory 106, database server 102 sends a request for the item to the storage system 104. Storage system 104 responds to the request by reading the item from non-volatile memory (such as disk 112), and sending the item to the database server 102. As data is written to or retrieved from disk 112, the data is temporarily stored in volatile memory 106 within storage system 104.
When the database server 102 receives the item from storage system 104, database server 102 stores the item in shared cache 108. If shared cache 108 is currently full, the database server 102 first makes room for the new item by selecting an existing item for replacement. If the item that is selected for replacement is “dirty”, then the item must be sent to the storage system 104 before replacing the item within the shared cache 108. A dirty item is an item that has been updated after its retrieval from the storage system 104, so that the version of the item that resides in shared cache 108 differs from and is more recent than the version of the item that resides in the storage system 104.